import React from 'react'
import H2Com from './02_H2';
import Buttons from './03_Buttons';
import store from '../../redux/store';
import { increAction, decreAction } from '../../redux/reducers/zanReducer';
export default function ReduxCom() {

  let zan = () => {
    store.dispatch(increAction());
  }

  let cancelZan = () => {
    store.dispatch(decreAction());
  }

  return (
    <div style={{padding: 50}}>
      <H2Com />
      <hr />
      <Buttons />

      <h2>点赞数: {store.getState().zan}</h2>
      <button onClick={zan}>点赞</button>
      <button onClick={cancelZan}>取消点赞</button>
    </div>  
  )
}
